package com.jeff.tianti.cms.service;

import com.jeff.tianti.cms.dao.CourseDao;
import com.jeff.tianti.cms.dao.TeachDao;
import com.jeff.tianti.cms.dto.CourseQueryDTO;
import com.jeff.tianti.cms.dto.TeachQueryDTO;
import com.jeff.tianti.cms.entity.Course;
import com.jeff.tianti.cms.entity.Teach;
import com.jeff.tianti.common.PageBean;
import com.jeff.tianti.common.entity.PageModel;
import com.jeff.tianti.common.service.CommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author xujianfang
 * @desc ArticleService类
 * @date 2017-03-16
 */
@Service
public class CourseService extends CommonService<Course, String> {

    @Autowired
    private CourseDao courseDao;

    @Autowired
    public void setArticleDao(CourseDao courseDao) {
        super.setCommonDao(courseDao);
    }

    public PageModel<Course> queryCoursePage(CourseQueryDTO courseQueryDTO) {
        return this.courseDao.queryCoursePage(courseQueryDTO);
    }

    public void updateSelectiveById(Course course) {
        this.courseDao.updateSelectiveById(course);

    }

    public Page<Course> findAllNoDel(Pageable pageable) {
        return this.courseDao.findAllNoDel(pageable);
    }

    public Page<Course> findAllNoDel(String courseId, Pageable pageable) {
        return this.courseDao.findAllNoDel(pageable);
    }

    public PageModel<Map<String, Object>> queryCourseList(PageBean pageBean) {
        return this.courseDao.queryCourseList(pageBean);
    }

    public PageModel<Map<String, Object>> queryCourseList(CourseQueryDTO courseQueryDTO) {
        return this.courseDao.queryCourseListByTeachId(courseQueryDTO.getTeachId(), courseQueryDTO.getCurrentPage(), courseQueryDTO.getPageSize());
    }

    public Course queryCourseById(String id) {
        return this.courseDao.findById(id);
    }

    public PageModel<Map<String, Object>> queryCourseListByBast(int currentPage, int totalPage) {
        return this.courseDao.queryCourseListByBast(currentPage, totalPage);
    }

    public List getLastSixDay() {
        return this.courseDao.getLastSixDay();
    }

    public List getLastSixDayCourse(String startTime){
        return this.courseDao.getLastSixDayCourse(startTime);
    }

    public List<Course> queryCourseListByCondition(CourseQueryDTO courseQueryDTO){
       return this.courseDao.queryCourseList(courseQueryDTO);
    }

    public List<Map<String, Object>> getCourseListByCateId(String columnId) {
        return this.courseDao.getCourseListByCateId(columnId);
    }
}